<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>交流社区</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link rel="stylesheet" href="../res/layui/css/layui.css">
    <link rel="stylesheet" href="../res/css/global.css">
    <script src="../js/plugins/jquery.js"></script>
    <script src="../js/plugins/jquery.cookie.min.js"></script>
    <style>
        .listType {
            padding: 2px;
        }
    </style>
</head>
<body style="margin-top: 60px">

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="./index.html">
            <img src="../res/images/logo.png" alt="layui">
        </a>


        <ul class="layui-nav fly-nav-user">

            <!-- 未登入的状态 -->
            <li class="layui-nav-item">
                <a class="iconfont icon-touxiang layui-hide-xs" href="user/login.html"></a>
            </li>

            <li id="loginB" class="layui-nav-item">
                <a href="user/login.html">登入</a>
            </li>
            <li id="registerB" class="layui-nav-item">
                <a href="user/reg.html">注册</a>
            </li>


        </ul>
    </div>
</div>

<div class="fly-panel fly-column">
    <div class="layui-container">
        <div class="fly-column-right layui-hide-xs">
            <span class="fly-search"><i class="layui-icon"></i></span>
            <a href="jie/add.html" class="layui-btn">发表新帖</a>
        </div>

    </div>
</div>

<div class="layui-container">
    <div class="layui-row layui-col-space15">
        <div id="list_area" class="layui-col-md8">
        </div>
        <div class="layui-col-md4">
            <dl class="fly-panel fly-list-one">
                <dt class="fly-panel-title">旅游专区</dt>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/weifang.html">潍坊市旅游攻略</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>
                        <!--<span class="layui-badge fly-badge-accept layui-hide-xs">已结</span>-->

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/qingdao.html">青岛经典三日游</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/yantai.html">烟台市旅游攻略</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/weihai.html">威海市必游景点大全</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/rizhao.html">日照市1-2日游行程规划</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/jinan.html">济南必游推荐</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/zibo.html">淄博民俗大盘点</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>

                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/linyi.html">临沂市必游景点盘点</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/zaozhuang.html">枣庄市小众景点列举</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/jining.html">孔子故里——济宁</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/taian.html">泰安必游景点推荐</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>

                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/heze.html">菏泽——牡丹园</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/liaocheng.html">聊城旅游攻略</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/dezhou.html">德州市旅游攻略</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
                <dd>
                    <h2>
                        <a class="layui-badge">旅游</a>
                        <a href="./lvyou/dongying.html">黄河入海，红毯迎宾——东营</a>
                    </h2>
                    <div class="fly-list-info">
                        <a href="user/home.html" link>
                        </a>

                    </div>
                    <div class="fly-list-badge">
                        <!--<span class="layui-badge layui-bg-red">精帖</span>-->
                    </div>
                </dd>
            </dl>


        </div>


    </div>
</div>


<script src="../res/layui/layui.js"></script>
<script>
    layui.cache.page = '';
    layui.cache.user = {
        username: '游客'
        , uid: -1
        , avatar: '../res/images/avatar/00.jpg'
        , experience: 83
        , sex: '男'
    };
    layui.config({
        version: "3.0.0"
        , base: '../res/mods/' //这里实际使用时，建议改成绝对路径
    }).extend({
        fly: 'index'
    }).use('fly');

    $(document).ready(function () {
        var telephone = $.cookie('TelephoneNum');

        if (telephone != undefined || telephone != null) {
            $('#loginB').empty().append('<a>' + telephone + '</a>');
            $('#registerB').empty().append('<a id="exit"  style="cursor: pointer">退出</a>');

            $('#exit').click(function () {

                $('#loginB').empty().append('<a href="user/login.html" >登入</a>');
                $('#registerB').empty().append(' <a href="user/reg.html">注册</a>');
            })

        }


        listArea = document.getElementById('list_area');
        $.ajax({
            type: "GET",
            contentType: "application/x-www-form-urlencoded",
            url: "http://localhost:8089/article/listArticle",
            data: {},
            xhrFields: {withCredentials: true},
            success: function (data) {
                var list = data.data;
                for (var i = 0; i < list.length; i++) {
                    var contentHtml = document.createElement('div');

                    var str = list[i].time;
                    var pubTime = str.substring(0, 10);

                    contentHtml.innerHTML = "<div class=\"fly-panel\" style=\"height: 180px;\">\n" +
                        "                <div class=\"fly-panel-title fly-filter\">\n" +
                        "                    <a>第 " + (i+1) + " 楼</a>\n" +
                        "                </div>\n" +
                        "                <ul class=\"fly-list\">\n" +
                        "                    <li>\n" +
                        "                        <a  class=\"fly-avatar\">\n" +
                        "                            <img src=\"https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg\" >\n" +
                        "                        </a>\n" +
                        "                        <h2 class=\"listType\">\n" +
                        "                            <span class=\"layui-badge\" id=\"list_type\">" + list[i].type + "</span>\n" +
                        "                        </h2>\n" +
                        "                        <div class=\"fly-list-info\">\n" +
                        "                            <span class=\"fly-list-nums\"><i class=\"iconfont icon-pinglun1\" title=\"回答\"></i>" + pubTime + "</span>\n" +
                        "                            <div >\n" +
                        "                                <span id=\"list_title\">标题:</span><span>" + list[i].title + "</span>\n" +
                        "                            <p id=\"list_content\">'" + list[i].content + "'</p>\n" +
                        "                            </div>\n" +
                        "                        </div>\n" +
                        "                        <div class=\"fly-list-badge\">\n" +
                        "                            <!--\n" +
                        "                            <span class=\"layui-badge layui-bg-black\">置顶</span>\n" +
                        "                            <span class=\"layui-badge layui-bg-red\">精帖</span>\n" +
                        "                            -->\n" +
                        "                        </div>\n" +
                        "                    </li>\n" +
                        "\n" +
                        "                </ul>\n" +
                        "            </div>";
                    listArea.appendChild(contentHtml);
                }
            },
            //失败的回调函数
            error: function (data) {
                console.log(data.status)
            }
        });
    })
</script>

<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cspan id='cnzz_stat_icon_30088308'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "w.cnzz.com/c.php%3Fid%3D30088308' type='text/javascript'%3E%3C/script%3E"));</script>

</body>
</html>